import { main } from './index.module.scss';
import {importStores,importBlocks,importSlots,importDialogs} from 'zbee-webpack'
const {
    'BasicTable/Header':Header
} = importBlocks() 
import status from './slots/status.slot';
const {
    useBasicTableStore
} = importStores();

export default {
    useWidgets: [
        'text',
        'image',
        'horizontalLayout'
    ],
    body: {
        mode: 'flex',
        class: main,
        items: [
            {
                widget: Header,
            },
            {
                id: 'table',
                widget: 'table',
                border: true,
                useStore: useBasicTableStore,
                columns: [{
                    type: 'index'
                }, {
                    label: '名称',
                    align: 'center',
                    prop:'name'
                }, {
                    label: '类型',
                    align: 'center',
                    prop: 'category',
                }, {
                    label: '设备',
                    align: 'center',
                    prop: 'device',
                    type: 'custom',
                    viewer: status
                }, {
                    label: '工艺',
                    align: 'center',
                    prop: 'createdMethod',
                    type: 'custom',
                    viewer: status,
                   
                }, {
                    label: '材料',
                    align: 'center',
                    prop: 'material',
                    type: 'custom',
                    viewer: status,               
                }, {
                    label: 'BOM单价',
                    align: 'center',
                    prop: 'unitPrice',
                    type: 'custom',
                    viewer: status, 
                }, {
                    label: '数量',
                    align: 'center',
                    prop: 'nums',
                    type: 'custom',
                    // editor:Input
                },  {
                    label: '总价',
                    align: 'center',
                    prop: 'totalPrice',
                   
                },{
                    label: '操作',
                    align: 'center',
                    width: 180,
                    type: 'button',
                    buttons: [{
                        text: '编辑',
                        onClick: [{
                         action:'message',
                         message:'功能正在开发中',
                         type:'warning'
                        }]
                    }, {
                        text: '删除',
                        // hidden:'isEdittingRow($row)',
                        onClick: [{
                            action:'param',
                            var:'dataRow',
                            index:0
                        },{
                            action: 'store',
                            useStore:useBasicTableStore,
                            method:'delete',
                            params:'$vars.dataRow'
                        }]
                    }]
                }],
            }]
    }
}